<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
    <script>
    //闭包实际应用中主要用于封装变量，收敛权限
    function isFirstLoad(){
    	var _list=[];
    	return function(id){
    		if(_list.indexOf(id)>=0){
    			return false
    		}else{
    			_list.push(id)
    			return true
    		}
    	}
    }      
    var firstLoad=isFirstLoad();
    console.log(firstLoad(10));
    console.log(firstLoad(10));
    console.log(firstLoad(20));
    console.log(firstLoad(20));
    </script>
    </body>
</html>